#include "Includes.h"
#include "DEV_Main.h"
#include "stdio.h"
#include "OPP_ErrorCode.h"
#include "OPP_Debug.h"

extern void nfc_init(void);
void DEV_MAIN_INIT(void)
{
    U32 err;
    
    nfc_init();
    //BY25Q64_Debug();
    err=MeterInit();
    if(err!=0)
    {
        DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "init meter err:%ld\r\n",err);
    }
    err = NeulInit();
    if(0 != err){
        DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "NeulInit err ret %d\r\n", err); 
    }
    err = initEvent();
    if(0 != err){
		DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "initEvent err ret %d\r\n", err); 
    }
    err=Ec600sInit();
    if(err!=0)
    {
        DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "init ec600s err:%ld\r\n",err);
    }
    err = DAInit();
    if(0 != err){
        DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "DAInit err ret %d\r\n", err);
    }
    err = StaInit();
    if(0 != err){
        DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "StaInit err ret %d\r\n", err);
    }
    err=TTimer_Init();
    if(0 != err){
        DEBUG_LOG(DEBUG_MODULE_MAIN, DLL_ERROR, "TTimerInit err ret %d\r\n", err);
    }
}

uint8_t nfc_process(void);
uint8_t card_flg=0;
        
void DEV_MAIN_LOOP(void)
{
    card_flg = nfc_process();
    ErcRegCheckLoop();
    TTimer_Loop();
}


